package com.LeeCode;

/**
 * 3 的幂
 */

public class Code326 {
    public static void main(String[] args) {

    }

    public boolean isPowerOfThree(int n) {
        if (n <= 0) return false;
        double log = Math.log(n) / Math.log(3);
        return Math.abs(log - Math.round(log)) < 1e-10;
    }
}
